package com.alex.statistics;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.time.LocalDateTime;

@Slf4j
@SpringBootApplication
@EnableScheduling
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @EventListener
    public void start(ApplicationStartedEvent event) {
        log.info("[服务启动],{}", LocalDateTime.now());
    }

    @EventListener
    public void end(ContextClosedEvent event) {
        log.info("[服务停止],{}", LocalDateTime.now());
    }
}
